package com.library.librarybackend.domain.enums;

import lombok.Getter;

import java.util.Arrays;

/**
 * @author 平
 * @description 性别枚举
 * @since 2025-09-20 21:49
 */
@Getter
public enum GenderEnum {
    UNKNOWN(-1, "未知"),
    WOMAN(0, "女"),
    MAN(1, "男");

    private final Integer code;
    private final String message;

    GenderEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public static Boolean isExist(Integer code) {
        return Arrays.stream(GenderEnum.values())
                .anyMatch(gender -> gender.code.equals(code));
    }

}
